#include<stdio.h>

/*c语言指针学习第8课：数组指针*/

int main()
{
    int arr[] = {10,20,30,40,50};
    int len = sizeof(arr) / sizeof(arr[0]);

    int (*P2)[len] = &arr;//获取指针的步长/长度=arr的总长度
    int *P1 = arr;//获取数组地址时不需要加&（arr会退化）
    int *p1 = &arr[0];


    printf("%p\n",P1);
    printf("%p\n",p1);

    for (int i = 0; i < len; i++)//遍历数组
    {
        printf("%d\n",*(P1+i));
    }

    printf("%zu\n",sizeof(arr));
    printf("%p and %p\n",arr,arr+1);
    printf("%p and %p\n",&arr,&arr+1);

    return 0;
}